<!DOCTYPE html>
<html>
    <head>
        <script src="js/vue.js"></script>
        <style>
            .row-enter {
                width: 0px;
            }

            .row-enter-active {
                transition: width 3s;
            }

            .row-enter-to {
                width: 100%;
            }


            .red {
                background: red;
                height: 20px;
            }

            .blue {
                background: blue;
                height: 20px;
            }

            .yellow {
                background: yellow;
                height: 20px;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <button @click="showNum">切换</button>
            <div>
                <transition name="row">
                    <div class="red" v-if="show == 'A'" key="A"></div>
                    <div class="blue" v-if="show == 'B'" key="B"></div>
                    <div class="yellow" v-if="show == 'C'" key="C"></div>
                </transition>
            </div>
        </div>
        <script>
            var vm = new Vue({
                el:'#app',
                data : { show : 'A'},
                methods : {
                    showNum() {
                        if(this.show == 'A'){
                            this.show = 'B';
                        }
                        else if (this.show == 'B') {
                            this.show = 'C';
                        }
                        else{
                            this.show = 'A';
                        }
                    }
                }
            });
        </script>
    </body>
</html>